<?php
namespace App\Modules\Health\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;

class Acupoint extends Model
{
    use HasDateTimeFormatter;

    protected $table = 'health_acupoint';

    protected $primaryKey = 'id';

    protected $fillable = [
        'name', // 名称
        'description', // 描述
        'pin_yin', // 拼音
        'point_description', // 位置描述
        'img', // 图片路径
        'point_img', // 位置图片路径
        'video_file', // 视频文件路径
        'wushu_id', // 五输穴ID
        'teding_id', // 特定穴ID
    ];

    public function body()
    {
        return $this->hasOneThrough(Body::class, AcuBody::class, 'acu_id', 'id', 'id', 'body_id');
    }

    public function body_point()
    {
        return $this->hasOneThrough(BodyPart::class, AcuBodyPart::class, 'acu_id', 'id', 'id', 'body_part_id');
    }

    public function meridian()
    {
        return $this->hasOneThrough(Meridian::class, AcuMeridian::class, 'acu_id', 'id', 'id', 'meridian_id');
    }

    public function wushu()
    {
        return $this->hasOne(HealthWushuAcupoint::class, 'id', 'wushu_id');
    }

    public function teding()
    {
        return $this->hasOne(HealthTedingAcupoint::class, 'id', 'teding_id');
    }
}
